Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra_filerefs to sls_build #47148

Merged

Conversation

LukeCarrier
Copy link
Contributor

@LukeCarrier LukeCarrier commented Apr 18, 2018

What does this PR do?

Adds an extra_filerefs option to docker.sls_build, consistent with the salt-ssh --extra-filerefs option. This enables developers to include requirements of templates (e.g. a macros.sls file) in the thin bundle sent to the container.

What issues does this PR fix or reference?

Previous Behavior

Any missing template dependencies would fail with a TemplateNotFound error like the following:

Traceback (most recent call last):
  File "/tmp/salt.docker.[snip]/pyall/salt/utils/templates.py", line 388, in render_jinja_tmpl
    output = template.render(**decoded_context)
  File "/tmp/salt.docker.[snip]/pyall/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/tmp/salt.docker.[snip]/pyall/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "<template>", line 1, in top-level template code
  File "/tmp/salt.docker.[snip]/pyall/salt/utils/jinja.py", line 140, in get_source
    raise TemplateNotFound(template)
TemplateNotFound: web-base/macros.sls

New Behavior

Including extra_filerefs, e.g. as follows, allows the states to complete as the necessary dependencies are included in the thin archive transferred to the container:

$ salt-call \
        --local --file-root ~/salt --pillar-root ~/pillar \
        docker.sls_build container base=base mods=some-state,some-other-state \
        extra_filerefs=salt://some-state/some-dep.jinja

Tests written?

No -- I'm not sure how best to test this. I'm happy to try if I can get an idea of where to start?

Commits signed with GPG?

No

@rallytime rallytime merged commit a72affc into saltstack:develop Apr 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants